|
Исходный файл C:\WINCE600\PUBLIC\RDP\OAK\UIT \WBTCMNPRPG\displayproperties.cpp |
Модифицированный файл C:\WINCE600\OSDesigns\ThinClient\ThinClient \RDP_MOD\WBTCMNPRPG\displayproperties.cpp |
||
|---|---|---|---|
// |
// |
||
// Copyright (c) Microsoft Corporation. All rights reserved. |
// Copyright (c) Microsoft Corporation. All rights reserved. |
||
// |
// |
||
// |
// |
||
// Use of this sample source code is subject to the terms of the Microsoft |
// Use of this sample source code is subject to the terms of the Microsoft |
||
// license agreement under which you licensed this sample source code. If |
// license agreement under which you licensed this sample source code. If |
||
// you did not accept the terms of the license agreement, you are not |
// you did not accept the terms of the license agreement, you are not |
||
// authorized to use this sample source code. For the terms of the license, |
// authorized to use this sample source code. For the terms of the license, |
||
// please see the license agreement between you and Microsoft or, if applicable, |
// please see the license agreement between you and Microsoft or, if applicable, |
||
// see the LICENSE.RTF on your install media or the root of your tools installation. |
// see the LICENSE.RTF on your install media or the root of your tools installation. |
||
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES. |
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES. |
||
// |
// |
||
|
|
||
#include "DisplayProperties.hpp" |
#include "DisplayProperties.hpp" |
||
#include "ioctl.h" |
#include "ioctl.h" |
||
#include "regmgr.h" |
#include "regmgr.h" |
||
#include "propnames.h" |
#include "propnames.h" |
||
|
|
||
static const int s_MAX_DISPLAYVALUELEN = 255; |
static const int s_MAX_DISPLAYVALUELEN = 255; |
||
|
|
||
CDisplayPropPage::CDisplayPropPage (CTerminalPropSheet *pOwner) : |
CDisplayPropPage::CDisplayPropPage (CTerminalPropSheet *pOwner) : |
||
CTerminalPropPage(pOwner), |
CTerminalPropPage(pOwner), |
||
m_bScrSaver(FALSE), |
m_bScrSaver(FALSE), |
||
m_nScrTimeout(10), |
m_nScrTimeout(10), |
||
m_displayType(0), |
m_displayType(0), |
||
m_curSetting(0), |
m_curSetting(0), |
||
m_bTested (FALSE), |
m_bTested (FALSE), |
||
m_colorChanged(TRUE), |
m_colorChanged(TRUE), |
||
headColorInfo(NULL), |
headColorInfo(NULL), |
||
m_bDisplayBbar(TRUE) |
m_bDisplayBbar(TRUE) |
||
|
|
||
{ |
{ |
||
m_displayChanged=FALSE; |
m_displayChanged=FALSE; |
||
m_bWizard = pOwner->GetWizardFlag(); |
m_bWizard = pOwner->GetWizardFlag(); |
||
DEBUGMSG (1, (L"CDisplayPropPage::CDisplayPropPage( |
DEBUGMSG (1, (L"CDisplayPropPage::CDisplayPropPage( |
||
Init (IDD_DISPLAY_PAGE); |
Init (IDD_DISPLAY_PAGE); |
||
|
|
||
memset(&m_displayTableName,0,MAX_DISPL |
memset(&m_displayTableName,0,MAX_DISPL |
||
} |
} |
||
|
|
||
CDisplayPropPage::~CDisplayPropPage() |
CDisplayPropPage::~CDisplayPropPage() |
||
{ |
{ |
||
PCOLORINFO tempColorInfo = NULL; |
PCOLORINFO tempColorInfo = NULL; |
||
|
|
||
while (headColorInfo) |
while (headColorInfo) |
||
{ |
{ |
||
tempColorInfo = headColorInfo; |
tempColorInfo = headColorInfo; |
||
headColorInfo = headColorInfo->next; |
headColorInfo = headColorInfo->next; |
||
free (tempColorInfo); |
free (tempColorInfo); |
||
} |
} |
||
if(m_displayTableName ) |
if(m_displayTableName ) |
||
{ |
{ |
||
for (int i=0; i < MAX_DISPLAY_KEYS; i++) |
for (int i=0; i < MAX_DISPLAY_KEYS; i++) |
||
{ |
{ |
||
if (m_displayTableName[i] != NULL) |
if (m_displayTableName[i] != NULL) |
||
{ |
{ |
||
delete[] m_displayTableName[i]; |
delete[] m_displayTableName[i]; |
||
m_displayTableName[i] = NULL; |
m_displayTableName[i] = NULL; |
||
} |
} |
||
} |
} |
||
} |
} |
||
} |
} |
||
|
|
||
|
|
||
LRESULT CDisplayPropPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) |
LRESULT CDisplayPropPage::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) |
||
{ |
{ |
||
DEBUGMSG (1, (L"CDisplayPropPage::OnInitDialog() -- class is [%s]\n", GetId())) ; |
DEBUGMSG (1, (L"CDisplayPropPage::OnInitDialog() -- class is [%s]\n", GetId())) ; |
||
CGenericPropPage::OnInitDialog (uMsg, wParam, lParam, bHandled); |
CGenericPropPage::OnInitDialog (uMsg, wParam, lParam, bHandled); |
||
|
|
||
// attach controls |
// attach controls |
||
if(!m_bWizard) |
if(!m_bWizard) |
||
{ |
{ |
||
m_scrSaverCheck.Attach (GetDlgItem(IDC_ENABLE_SCR_SVR_CHK)); |
m_scrSaverCheck.Attach (GetDlgItem(IDC_ENABLE_SCR_SVR_CHK)); |
||
m_scrSaverTimeout.Attach (GetDlgItem(IDC_SPIN_EDIT)); |
m_scrSaverTimeout.Attach (GetDlgItem(IDC_SPIN_EDIT)); |
||
m_spinctl.Attach (GetDlgItem(IDC_SPIN1)); |
m_spinctl.Attach (GetDlgItem(IDC_SPIN1)); |
||
m_scrWait.Attach(GetDlgItem(IDC_WAIT_S |
m_scrWait.Attach(GetDlgItem(IDC_WAIT_S |
||
// set initial values |
// set initial values |
||
m_spinctl.SendMessage (UDM_SETRANGE, 0, MAKELPARAM(20,1)); |
m_spinctl.SendMessage (UDM_SETRANGE, 0, MAKELPARAM(20,1)); |
||
m_spinctl.SendMessage (UDM_SETPOS, 0, MAKELONG(20, 0)); |
m_spinctl.SendMessage (UDM_SETPOS, 0, MAKELONG(20, 0)); |
||
|
|
||
|
|
||
UpdateScreenSaver(); |
UpdateScreenSaver(); |
||
|
|
||
|
|
||
} |
} |
||
else if (!m_pWbtWiz) |
else if (!m_pWbtWiz) |
||
{ |
{ |
||
DEBUGMSG (1, (L"WBTWIZ::CDisplayPropPage::OnInitDia |
DEBUGMSG (1, (L"WBTWIZ::CDisplayPropPage::OnInitDia |
||
EndDialog (0); |
EndDialog (0); |
||
return 0; |
return 0; |
||
} |
} |
||
|
|
||
|
|
||
m_displayChoices.Attach (GetDlgItem(IDC_DISPLAY_COMBO)); |
m_displayChoices.Attach (GetDlgItem(IDC_DISPLAY_COMBO)); |
||
m_test.Attach (GetDlgItem(IDC_TEST_BTN)); |
m_test.Attach (GetDlgItem(IDC_TEST_BTN)); |
||
|
////////////////////////////////////// |
||
|
// Rename button
|
||
|
m_test.SetWindowText(L"Set");
|
||
|
////////////////////////////////////// |
||
//disabling in the beginning |
//disabling in the beginning |
||
m_test.EnableWindow(FALSE); |
m_test.EnableWindow(FALSE); |
||
|
|
||
if (m_bWizard) |
if (m_bWizard) |
||
{ |
{ |
||
m_colorChoices.Attach(GetDlgItem(IDC_C |
m_colorChoices.Attach(GetDlgItem(IDC_C |
||
m_wndBitmap.Attach(GetDlgItem(IDC_COLO |
m_wndBitmap.Attach(GetDlgItem(IDC_COLO |
||
} |
} |
||
|
|
||
DEBUGMSG(1,(L"ATLPROP::OnInitDialog() -- Calling Color Choices")); |
DEBUGMSG(1,(L"ATLPROP::OnInitDialog() -- Calling Color Choices")); |
||
|
|
||
if (!UpdateColorChoices()) |
if (!UpdateColorChoices()) |
||
{ |
{ |
||
DEBUGMSG(1,(L"ATLPROP::OnInitDialog() -- Failed to Initialize Colors")); |
DEBUGMSG(1,(L"ATLPROP::OnInitDialog() -- Failed to Initialize Colors")); |
||
return -1; |
return -1; |
||
} |
} |
||
if (!UpdateDisplayChoices()) |
if (!UpdateDisplayChoices()) |
||
{ |
{ |
||
RETAILMSG(1,(L"ATLPROP::OnInitDialog() |
RETAILMSG(1,(L"ATLPROP::OnInitDialog() |
||
return -1; |
return -1; |
||
} |
} |
||
|
|
||
// update the bitmap display |
// update the bitmap display |
||
UpdateBitmap(); |
UpdateBitmap(); |
||
|
|
||
return 1; |
return 1; |
||
} |
} |
||
|
|
||
|
|
||
LRESULT CDisplayPropPage::OnCommandMsg(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) |
LRESULT CDisplayPropPage::OnCommandMsg(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) |
||
{ |
{ |
||
|
|
||
|
|
||
if ( HIWORD(wParam) == CBN_SELCHANGE ) |
if ( HIWORD(wParam) == CBN_SELCHANGE ) |
||
OnDisplayChoicesChange(); |
OnDisplayChoicesChange(); |
||
else if ( !m_bWizard &&( HIWORD(wParam) == EN_UPDATE ) && ( LOWORD(wParam) == IDC_SPIN_EDIT ) |
else if ( !m_bWizard &&( HIWORD(wParam) == EN_UPDATE ) && ( LOWORD(wParam) == IDC_SPIN_EDIT ) |
||
&& (m_scrSaverTimeout != NULL)) |
&& (m_scrSaverTimeout != NULL)) |
||
{ |
{ |
||
TCHAR szBuf[10]={0}; |
TCHAR szBuf[10]={0}; |
||
int timeOut = 0; |
int timeOut = 0; |
||
|
|
||
m_scrSaverTimeout.GetWindowText(szBuf, |
m_scrSaverTimeout.GetWindowText(szBuf, |
||
|
|
||
if ( ( szBuf != NULL ) && ( szBuf[0] != '\0' ) ) |
if ( ( szBuf != NULL ) && ( szBuf[0] != '\0' ) ) |
||
{ |
{ |
||
timeOut = _ttoi (szBuf); |
timeOut = _ttoi (szBuf); |
||
if( ( timeOut <= 0 ) || ( timeOut > (DEFAULT_SCREENSAVER_TIMEOUT/60))) |
if( ( timeOut <= 0 ) || ( timeOut > (DEFAULT_SCREENSAVER_TIMEOUT/60))) |
||
{ |
{ |
||
LPCTSTR pszTitle = LoadStringEx (IDS_TIMEOUT_CAPTION); |
LPCTSTR pszTitle = LoadStringEx (IDS_TIMEOUT_CAPTION); |
||
LPCTSTR pszMsg = LoadStringEx (IDS_TIMEOUT_ERROR); |
LPCTSTR pszMsg = LoadStringEx (IDS_TIMEOUT_ERROR); |
||
|
|
||
if (pszTitle && pszMsg) |
if (pszTitle && pszMsg) |
||
MessageBox (pszMsg, pszTitle, MB_ICONINFORMATION | MB_OK); |
MessageBox (pszMsg, pszTitle, MB_ICONINFORMATION | MB_OK); |
||
|
|
||
m_scrSaverTimeout.SetWindowText(L""); |
m_scrSaverTimeout.SetWindowText(L""); |
||
} |
} |
||
} |
} |
||
else if ( wcscmp(szBuf,L"")==0) |
else if ( wcscmp(szBuf,L"")==0) |
||
{ |
{ |
||
m_scrSaverTimeout.SetWindowText(L"1"); |
m_scrSaverTimeout.SetWindowText(L"1"); |
||
DEBUGMSG(1,(L"ATLPROP::OnInitDialog() -- Scr Saver Timeout is SET to 1")); |
DEBUGMSG(1,(L"ATLPROP::OnInitDialog() -- Scr Saver Timeout is SET to 1")); |
||
m_scrSaverTimeout.SetFocus(); |
m_scrSaverTimeout.SetFocus(); |
||
return -1; |
return -1; |
||
} |
} |
||
|
|
||
} |
} |
||
return 1; |
return 1; |
||
} |
} |
||
|
|
||
|
|
||
LRESULT CDisplayPropPage::OnScrCheck (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) |
LRESULT CDisplayPropPage::OnScrCheck (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) |
||
{ |
{ |
||
int state = Button_GetCheck (m_scrSaverCheck); |
int state = Button_GetCheck (m_scrSaverCheck); |
||
m_bScrSaver = ((state) == BST_CHECKED); |
m_bScrSaver = ((state) == BST_CHECKED); |
||
DEBUGMSG (1, (L"ATLPROP::OnScrCheck() -- m_bScrSaver = %d\n", m_bScrSaver)); |
DEBUGMSG (1, (L"ATLPROP::OnScrCheck() -- m_bScrSaver = %d\n", m_bScrSaver)); |
||
//MyTrace ((L"m_bScrSaver = %d\n", m_bScrSaver)); |
//MyTrace ((L"m_bScrSaver = %d\n", m_bScrSaver)); |
||
m_scrSaverTimeout.EnableWindow (m_bScrSaver); |
m_scrSaverTimeout.EnableWindow (m_bScrSaver); |
||
m_scrWait.EnableWindow (m_bScrSaver); |
m_scrWait.EnableWindow (m_bScrSaver); |
||
|
|
||
return 1; |
return 1; |
||
} |
} |
||
|
|
||
LRESULT CDisplayPropPage::OnBbarCheck (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) |
LRESULT CDisplayPropPage::OnBbarCheck (WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) |
||
{ |
{ |
||
int state = Button_GetCheck (m_wndDisplayBbar); |
int state = Button_GetCheck (m_wndDisplayBbar); |
||
m_bDisplayBbar = ((state) == BST_CHECKED); |
m_bDisplayBbar = ((state) == BST_CHECKED); |
||
return 1; |
return 1; |
||
} |
} |
||
|
|
||
// |
// |
||
// On Color Resolution change load appropriate BITMAP. |
// On Color Resolution change load appropriate BITMAP. |
||
// |
// |
||
void CDisplayPropPage::UpdateBitmap() |
void CDisplayPropPage::UpdateBitmap() |
||
{ |
{ |
||
HBITMAP hBmp = NULL; |
HBITMAP hBmp = NULL; |
||
int index=0, bmpIndx=0; |
int index=0, bmpIndx=0; |
||
TCHAR szSelColor[COLORCOMBO_LEN]={0}; |
TCHAR szSelColor[COLORCOMBO_LEN]={0}; |
||
|
|
||
PCOLORINFO tempColorInfo = NULL; |
PCOLORINFO tempColorInfo = NULL; |
||
|
|
||
if (!m_bWizard) |
if (!m_bWizard) |
||
return; |
return; |
||
|
|
||
index = m_colorChoices.SendMessage( CB_GETCURSEL,0,0 ); |
index = m_colorChoices.SendMessage( CB_GETCURSEL,0,0 ); |
||
|
|
||
if ((index == CB_ERR) || (m_colorChoices.SendMessage ( CB_GETLBTEXT, |
if ((index == CB_ERR) || (m_colorChoices.SendMessage ( CB_GETLBTEXT, |
||
(WPARAM)index, |
(WPARAM)index, |
||
(LPARAM)szSelColor) |
(LPARAM)szSelColor) |
||
== CB_ERR )) |
== CB_ERR )) |
||
{ |
{ |
||
RETAILMSG (1,(L"CDisplayPropPage::UpdateBitmap( )--CB_GETLBTEXT failed")); |
RETAILMSG (1,(L"CDisplayPropPage::UpdateBitmap( )--CB_GETLBTEXT failed")); |
||
return; |
return; |
||
} |
} |
||
|
|
||
for( tempColorInfo = headColorInfo; tempColorInfo; tempColorInfo=tempColorInfo->next) |
for( tempColorInfo = headColorInfo; tempColorInfo; tempColorInfo=tempColorInfo->next) |
||
{ |
{ |
||
if (wcscmp(tempColorInfo->colorTableName, |
if (wcscmp(tempColorInfo->colorTableName, |
||
{ |
{ |
||
break; |
break; |
||
} |
} |
||
bmpIndx++; |
bmpIndx++; |
||
} |
} |
||
|
|
||
switch (bmpIndx) |
switch (bmpIndx) |
||
{ |
{ |
||
case Color8: |
case Color8: |
||
hBmp = LoadBitmap( ghInstance, MAKEINTRESOURCE (IDB_COLOR8)); |
hBmp = LoadBitmap( ghInstance, MAKEINTRESOURCE (IDB_COLOR8)); |
||
break; |
break; |
||
case Color16: |
case Color16: |
||
hBmp = LoadBitmap( ghInstance, MAKEINTRESOURCE (IDB_COLOR16)); |
hBmp = LoadBitmap( ghInstance, MAKEINTRESOURCE (IDB_COLOR16)); |
||
break; |
break; |
||
default: |
default: |
||
hBmp = LoadBitmap( ghInstance, MAKEINTRESOURCE (IDB_COLOR24)); |
hBmp = LoadBitmap( ghInstance, MAKEINTRESOURCE (IDB_COLOR24)); |
||
} |
} |
||
m_wndBitmap.SendMessage (STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmp); |
m_wndBitmap.SendMessage (STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmp); |
||
|
|
||
} |
} |
||
|
|
||
LRESULT CDisplayPropPage::OnColorChoicesChange |
LRESULT CDisplayPropPage::OnColorChoicesChange |
||
{ |
{ |
||
UpdateBitmap(); |
UpdateBitmap(); |
||
return 1; |
return 1; |
||
} |
} |
||
|
|
||
void CDisplayPropPage::UpdateScreenSaver() |
void CDisplayPropPage::UpdateScreenSaver() |
||
{ |
{ |
||
Button_SetCheck (m_scrSaverCheck, m_bScrSaver ? BST_CHECKED : BST_UNCHECKED); |
Button_SetCheck (m_scrSaverCheck, m_bScrSaver ? BST_CHECKED : BST_UNCHECKED); |
||
SetDlgItemInt (m_hwnd, IDC_SPIN_EDIT, m_nScrTimeout, TRUE); |
SetDlgItemInt (m_hwnd, IDC_SPIN_EDIT, m_nScrTimeout, TRUE); |
||
m_scrSaverTimeout.EnableWindow (m_bScrSaver); |
m_scrSaverTimeout.EnableWindow (m_bScrSaver); |
||
m_scrWait.EnableWindow (m_bScrSaver); |
m_scrWait.EnableWindow (m_bScrSaver); |
||
} |
} |
||
|
|
||
BOOL CDisplayPropPage::ReadRegistrySettings |
BOOL CDisplayPropPage::ReadRegistrySettings |
||
{ |
{ |
||
if(!m_bWizard) |
if(!m_bWizard) |
||
{ |
{ |
||
m_bScrSaver = (GetScreenSaverEnable() == 1); |
m_bScrSaver = (GetScreenSaverEnable() == 1); |
||
m_nScrTimeout = GetScreenSaverTimeout() / 60; // convert seconds -> minutes |
m_nScrTimeout = GetScreenSaverTimeout() / 60; // convert seconds -> minutes |
||
|
|
||
m_bDisplayBbar = GetDisplayBbar(); |
m_bDisplayBbar = GetDisplayBbar(); |
||
} |
} |
||
return TRUE; |
return TRUE; |
||
} |
} |
||
|
|
||
BOOL CDisplayPropPage::WriteRegistrySetting |
BOOL CDisplayPropPage::WriteRegistrySetting |
||
{ |
{ |
||
RETAILMSG(1,(L"CDisplayPropPage::Write |
RETAILMSG(1,(L"CDisplayPropPage::Write |
||
if(m_displayChanged) |
if(m_displayChanged) |
||
{ |
{ |
||
if ( SetDisplayInfo() == FALSE ) |
if ( SetDisplayInfo() == FALSE ) |
||
{ |
{ |
||
// Error recovery and divert the user to safe place. |
// Error recovery and divert the user to safe place. |
||
RETAILMSG(1,(L"CDisplayPropPage::Write |
RETAILMSG(1,(L"CDisplayPropPage::Write |
||
|
|
||
} |
} |
||
else |
else |
||
{ |
{ |
||
RETAILMSG(1,(L"CDisplayPropPage::Write |
RETAILMSG(1,(L"CDisplayPropPage::Write |
||
} |
} |
||
} |
} |
||
|
|
||
if(!m_bWizard) |
if(!m_bWizard) |
||
{ |
{ |
||
if (!m_bScrSaver) |
if (!m_bScrSaver) |
||
SetScreenSaverEnable (0); |
SetScreenSaverEnable (0); |
||
else |
else |
||
{ |
{ |
||
SetScreenSaverEnable (1); |
SetScreenSaverEnable (1); |
||
SetScreenSaverTimeout((DWORD)m_nScrTim |
SetScreenSaverTimeout((DWORD)m_nScrTim |
||
SystemParametersInfo(SPI_SETSCREENSAVE |
SystemParametersInfo(SPI_SETSCREENSAVE |
||
} |
} |
||
|
|
||
SetDisplayBbar(m_bDisplayBbar); |
SetDisplayBbar(m_bDisplayBbar); |
||
} |
} |
||
|
|
||
if ( m_colorChanged ) |
if ( m_colorChanged ) |
||
{ |
{ |
||
if ( SetColorInfo() == FALSE ) |
if ( SetColorInfo() == FALSE ) |
||
{ |
{ |
||
// Error recovery and divert the user to safe place. |
// Error recovery and divert the user to safe place. |
||
RETAILMSG(1,(L"CDisplayPropPage::Write |
RETAILMSG(1,(L"CDisplayPropPage::Write |
||
|
|
||
} |
} |
||
else |
else |
||
{ |
{ |
||
RETAILMSG(1,(L"CDisplayPropPage::Write |
RETAILMSG(1,(L"CDisplayPropPage::Write |
||
} |
} |
||
|
|
||
} |
} |
||
|
|
||
return TRUE; |
return TRUE; |
||
} |
} |
||
|
|
||
// |
// |
||
// set the color info in the registry |
// set the color info in the registry |
||
// |
// |
||
BOOL CDisplayPropPage::SetColorInfo( ) |
BOOL CDisplayPropPage::SetColorInfo( ) |
||
{ |
{ |
||
UINT selIndex = 0; |
UINT selIndex = 0; |
||
UINT colIndex = 0; |
UINT colIndex = 0; |
||
HKEY hKey = NULL; |
HKEY hKey = NULL; |
||
TCHAR szSelColor[COLORCOMBO_LEN]={0}; |
TCHAR szSelColor[COLORCOMBO_LEN]={0}; |
||
PCOLORINFO tempColorInfo = NULL; |
PCOLORINFO tempColorInfo = NULL; |
||
|
|
||
if (!m_bWizard) |
if (!m_bWizard) |
||
return TRUE; |
return TRUE; |
||
|
|
||
selIndex = m_colorChoices.SendMessage( CB_GETCURSEL,0,0 ); |
selIndex = m_colorChoices.SendMessage( CB_GETCURSEL,0,0 ); |
||
|
|
||
if ((selIndex == CB_ERR) || (m_colorChoices.SendMessage ( CB_GETLBTEXT, |
if ((selIndex == CB_ERR) || (m_colorChoices.SendMessage ( CB_GETLBTEXT, |
||
(WPARAM)selIndex, |
(WPARAM)selIndex, |
||
(LPARAM)szSelColor) |
(LPARAM)szSelColor) |
||
== CB_ERR )) |
== CB_ERR )) |
||
{ |
{ |
||
RETAILMSG (1,(L"CDisplayPropPage::SetColorInfo( )--CB_GETLBTEXT failed")); |
RETAILMSG (1,(L"CDisplayPropPage::SetColorInfo( )--CB_GETLBTEXT failed")); |
||
return FALSE; |
return FALSE; |
||
} |
} |
||
|
|
||
hKey = OpenRegistryKey (HKLM, WBT_MSTSC_SETTINGS, KEY_READ); |
hKey = OpenRegistryKey (HKLM, WBT_MSTSC_SETTINGS, KEY_READ); |
||
if ( hKey == NULL ) |
if ( hKey == NULL ) |
||
{ |
{ |
||
// Create the Color Key |
// Create the Color Key |
||
hKey = CreateRegistryKey(HKLM, WBT_MSTSC_SETTINGS); |
hKey = CreateRegistryKey(HKLM, WBT_MSTSC_SETTINGS); |
||
if ( hKey == NULL ) |
if ( hKey == NULL ) |
||
{ |
{ |
||
RETAILMSG(1,(L"CDisplayPropPage::SetCo |
RETAILMSG(1,(L"CDisplayPropPage::SetCo |
||
return FALSE; |
return FALSE; |
||
} |
} |
||
} |
} |
||
|
|
||
for( tempColorInfo = headColorInfo; tempColorInfo; tempColorInfo=tempColorInfo->next) |
for( tempColorInfo = headColorInfo; tempColorInfo; tempColorInfo=tempColorInfo->next) |
||
{ |
{ |
||
if (wcscmp(tempColorInfo->colorTableName, |
if (wcscmp(tempColorInfo->colorTableName, |
||
{ |
{ |
||
break; |
break; |
||
} |
} |
||
} |
} |
||
// set the color value corresponding to the selection in the combobox. |
// set the color value corresponding to the selection in the combobox. |
||
|
|
||
if (tempColorInfo) |
if (tempColorInfo) |
||
{ |
{ |
||
SetRegistryKeyDWORD( hKey, COLOR_SETTINGS, tempColorInfo->colorTableValue); |
SetRegistryKeyDWORD( hKey, COLOR_SETTINGS, tempColorInfo->colorTableValue); |
||
RETAILMSG (1,(L"CDisplayPropPage::SetColorInfo() |
RETAILMSG (1,(L"CDisplayPropPage::SetColorInfo() |
||
tempColorInfo->colorTableValue)); |
tempColorInfo->colorTableValue)); |
||
} |
} |
||
|
|
||
CloseRegistryKey(hKey); |
CloseRegistryKey(hKey); |
||
return TRUE; |
return TRUE; |
||
} |
} |
||
|
|
||
BOOL CDisplayPropPage::GetCurrentColorSetti |
BOOL CDisplayPropPage::GetCurrentColorSetti |
||
{ |
{ |
||
DWORD size = sizeof(DWORD); |
DWORD size = sizeof(DWORD); |
||
DWORD type = 0; |
DWORD type = 0; |
||
HKEY hKey = NULL; |
HKEY hKey = NULL; |
||
|
|
||
if (ERROR_SUCCESS == RegOpenKeyEx(HKLM, WBT_MSTSC_SETTINGS, 0, KEY_READ, &hKey)) |
if (ERROR_SUCCESS == RegOpenKeyEx(HKLM, WBT_MSTSC_SETTINGS, 0, KEY_READ, &hKey)) |
||
{ |
{ |
||
if (RegQueryValueEx(hKey, COLOR_SETTINGS, NULL, &type, NULL, &size) |
if (RegQueryValueEx(hKey, COLOR_SETTINGS, NULL, &type, NULL, &size) |
||
== ERROR_SUCCESS && type == REG_DWORD ) |
== ERROR_SUCCESS && type == REG_DWORD ) |
||
{ |
{ |
||
RegQueryValueEx(hKey, COLOR_SETTINGS, NULL, NULL, (PBYTE)curColor, &size); |
RegQueryValueEx(hKey, COLOR_SETTINGS, NULL, NULL, (PBYTE)curColor, &size); |
||
|
|
||
if (size > 0) |
if (size > 0) |
||
{ |
{ |
||
CloseRegistryKey (hKey); |
CloseRegistryKey (hKey); |
||
DEBUGMSG (1,(L"ATLPROP::GetCurrentColorSetting -- RegistryKeyFound value is %d",*(curColor))); |
DEBUGMSG (1,(L"ATLPROP::GetCurrentColorSetting -- RegistryKeyFound value is %d",*(curColor))); |
||
return TRUE; |
return TRUE; |
||
} |
} |
||
} |
} |
||
|
|
||
RegCloseKey(hKey); |
RegCloseKey(hKey); |
||
} |
} |
||
return FALSE; |
return FALSE; |
||
} |
} |
||
|
|
||
|
|
||
|
|
||
BOOL CDisplayPropPage::UpdateColorChoices() |
BOOL CDisplayPropPage::UpdateColorChoices() |
||
{ |
{ |
||
HKEY hKey = NULL; |
HKEY hKey = NULL; |
||
DWORD index = 0; |
DWORD index = 0; |
||
DWORD curColor = 0, colorValue = 0; |
DWORD curColor = 0, colorValue = 0; |
||
TCHAR* szSubKey = NULL; |
TCHAR* szSubKey = NULL; |
||
TCHAR* colorName = NULL; |
TCHAR* colorName = NULL; |
||
PCOLORINFO curColorInfo = headColorInfo; |
PCOLORINFO curColorInfo = headColorInfo; |
||
PCOLORINFO newColorInfo=NULL; |
PCOLORINFO newColorInfo=NULL; |
||
DWORD iCount = -1; |
DWORD iCount = -1; |
||
|
|
||
if (!m_bWizard) |
if (!m_bWizard) |
||
return TRUE; |
return TRUE; |
||
|
|
||
HDC hDC = ::GetDC(NULL); |
HDC hDC = ::GetDC(NULL); |
||
UINT screenBpp = 8; |
UINT screenBpp = 8; |
||
if (hDC) |
if (hDC) |
||
{ |
{ |
||
screenBpp = GetDeviceCaps(hDC,BITSPIXEL); |
screenBpp = GetDeviceCaps(hDC,BITSPIXEL); |
||
::ReleaseDC(NULL,hDC); |
::ReleaseDC(NULL,hDC); |
||
} |
} |
||
|
|
||
if (screenBpp < 8) |
if (screenBpp < 8) |
||
screenBpp = 8; |
screenBpp = 8; |
||
|
|
||
hKey = OpenRegistryKey(HKEY_LOCAL_MACHINE,LOC |
hKey = OpenRegistryKey(HKEY_LOCAL_MACHINE,LOC |
||
|
|
||
if (hKey != NULL ) |
if (hKey != NULL ) |
||
{ |
{ |
||
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
||
|
|
||
while (( szSubKey = EnumerateRegistryValues(hKey,index++) ) != NULL ) |
while (( szSubKey = EnumerateRegistryValues(hKey,index++) ) != NULL ) |
||
{ |
{ |
||
if (GetRegistryDWORD(HKEY_LOCAL_MACHINE,L |
if (GetRegistryDWORD(HKEY_LOCAL_MACHINE,L |
||
{ |
{ |
||
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
||
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
||
if (szSubKey != NULL) |
if (szSubKey != NULL) |
||
{ |
{ |
||
free (szSubKey); |
free (szSubKey); |
||
} |
} |
||
|
|
||
if (colorValue > screenBpp) |
if (colorValue > screenBpp) |
||
{ |
{ |
||
break; |
break; |
||
} |
} |
||
|
|
||
if ((szSubKey=EnumerateRegistryValues(hKe |
if ((szSubKey=EnumerateRegistryValues(hKe |
||
{ |
{ |
||
colorName = GetRegistryString (HKEY_LOCAL_MACHINE,LOCAL_COLOR_KEY,sz |
colorName = GetRegistryString (HKEY_LOCAL_MACHINE,LOCAL_COLOR_KEY,sz |
||
if (colorName) |
if (colorName) |
||
{ |
{ |
||
DEBUGMSG (1,(L"ATLPROP::UpdateColorChoices() -- Enumerated ValueName is: %s\n",szSubKey)); |
DEBUGMSG (1,(L"ATLPROP::UpdateColorChoices() -- Enumerated ValueName is: %s\n",szSubKey)); |
||
DEBUGMSG (1,(L"ATLPROP::UpdateColorChoices() -- Enumerated value is :%s \n",colorName)); |
DEBUGMSG (1,(L"ATLPROP::UpdateColorChoices() -- Enumerated value is :%s \n",colorName)); |
||
if (szSubKey != NULL) |
if (szSubKey != NULL) |
||
{ |
{ |
||
free (szSubKey); |
free (szSubKey); |
||
} |
} |
||
m_colorChoices.SendMessage (CB_ADDSTRING,0,reinterpret_cast<LPARA |
m_colorChoices.SendMessage (CB_ADDSTRING,0,reinterpret_cast<LPARA |
||
++iCount; |
++iCount; |
||
} |
} |
||
} |
} |
||
else |
else |
||
{ |
{ |
||
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
||
goto END; |
goto END; |
||
} |
} |
||
|
|
||
// Create the Struct using the obtained values |
// Create the Struct using the obtained values |
||
if ((newColorInfo = (PCOLORINFO) malloc (sizeof (COLORINFO))) == NULL) |
if ((newColorInfo = (PCOLORINFO) malloc (sizeof (COLORINFO))) == NULL) |
||
{ |
{ |
||
RETAILMSG (1,(L"ATLPROP::UpdateColorChoices() -- Memory allocation failed")); |
RETAILMSG (1,(L"ATLPROP::UpdateColorChoices() -- Memory allocation failed")); |
||
goto END; |
goto END; |
||
} |
} |
||
|
|
||
newColorInfo->colorTableValue = colorValue; |
newColorInfo->colorTableValue = colorValue; |
||
StringCchCopy (newColorInfo->colorTableName, MAX_PATH, colorName); |
StringCchCopy (newColorInfo->colorTableName, MAX_PATH, colorName); |
||
newColorInfo->next = NULL; |
newColorInfo->next = NULL; |
||
|
|
||
if (curColorInfo != NULL) |
if (curColorInfo != NULL) |
||
{ |
{ |
||
curColorInfo->next = newColorInfo; |
curColorInfo->next = newColorInfo; |
||
curColorInfo = newColorInfo; |
curColorInfo = newColorInfo; |
||
} |
} |
||
else |
else |
||
{ |
{ |
||
headColorInfo = newColorInfo; |
headColorInfo = newColorInfo; |
||
curColorInfo = headColorInfo ; |
curColorInfo = headColorInfo ; |
||
} |
} |
||
if (colorName != NULL) |
if (colorName != NULL) |
||
free (colorName); |
free (colorName); |
||
} |
} |
||
else |
else |
||
{ |
{ |
||
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
||
goto END; |
goto END; |
||
} |
} |
||
} |
} |
||
|
|
||
|
|
||
if(GetCurrentColorSetting (&curColor)) |
if(GetCurrentColorSetting (&curColor)) |
||
{ |
{ |
||
//set current color settings as the selected one |
//set current color settings as the selected one |
||
for(curColorInfo = headColorInfo; curColorInfo; curColorInfo=curColorInfo->next) |
for(curColorInfo = headColorInfo; curColorInfo; curColorInfo=curColorInfo->next) |
||
{ |
{ |
||
if( curColorInfo->colorTableValue == curColor ) |
if( curColorInfo->colorTableValue == curColor ) |
||
{ |
{ |
||
m_colorChoices.SendMessage(CB_SELECTST |
m_colorChoices.SendMessage(CB_SELECTST |
||
0, (LPARAM)curColorInfo->colorTableName); |
0, (LPARAM)curColorInfo->colorTableName); |
||
break; |
break; |
||
} |
} |
||
} |
} |
||
} |
} |
||
else |
else |
||
{ |
{ |
||
m_colorChoices.SendMessage(CB_SETCURSE |
m_colorChoices.SendMessage(CB_SETCURSE |
||
DEBUGMSG (1,(L"ATLPROP::UpdateColorChoices() Selected element is the first element\n")); |
DEBUGMSG (1,(L"ATLPROP::UpdateColorChoices() Selected element is the first element\n")); |
||
} |
} |
||
} |
} |
||
else |
else |
||
{ |
{ |
||
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
DEBUGMSG(1,(L"ATLPROP::UpdateColorChoi |
||
goto END; |
goto END; |
||
} |
} |
||
|
|
||
CloseRegistryKey(hKey); |
CloseRegistryKey(hKey); |
||
return TRUE; |
return TRUE; |
||
|
|
||
END: return FALSE; |
END: return FALSE; |
||
} |
} |
||
|
|
||
|
|
||
LRESULT CDisplayPropPage::OnDisplayChoicesChan |
LRESULT CDisplayPropPage::OnDisplayChoicesChan |
||
{ |
{ |
||
m_displayChanged =TRUE; |
m_displayChanged =TRUE; |
||
|
|
||
if (m_displayChoices!=NULL) |
if (m_displayChoices!=NULL) |
||
{ |
{ |
||
int newSetting = m_displayChoices.SendMessage (CB_GETCURSEL); // get current selection |
int newSetting = m_displayChoices.SendMessage (CB_GETCURSEL); // get current selection |
||
if (newSetting != CB_ERR) |
if (newSetting != CB_ERR) |
||
{ |
{ |
||
if(!m_bWizard) |
if(!m_bWizard) |
||
GetOwner().SetReboot (TRUE); |
GetOwner().SetReboot (TRUE); |
||
m_bTested = FALSE; |
m_bTested = FALSE; |
||
m_test.EnableWindow (newSetting != m_curSetting); |
m_test.EnableWindow (newSetting != m_curSetting); |
||
} |
} |
||
} |
} |
||
return 1; |
return 1; |
||
} |
} |
||
|
|
||
LRESULT CDisplayPropPage::OnDisplayTest(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled) |
LRESULT CDisplayPropPage::OnDisplayTest(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled) |
||
{ |
{ |
||
|
////////////////////////////////////// |
||
|
/*
|
||
HDC hdc = ::GetDC (NULL); |
HDC hdc = ::GetDC (NULL); |
||
int height = GetDeviceCaps (hdc, VERTRES); |
int height = GetDeviceCaps (hdc, VERTRES); |
||
int width = GetDeviceCaps (hdc, HORZRES); |
int width = GetDeviceCaps (hdc, HORZRES); |
||
::ReleaseDC (NULL, hdc); |
::ReleaseDC (NULL, hdc); |
||
|
|
||
int result = IDCANCEL; |
int result = IDCANCEL; |
||
LPCTSTR pszTitle = LoadStringEx (IDS_TESTING_CAPTION); |
LPCTSTR pszTitle = LoadStringEx (IDS_TESTING_CAPTION); |
||
LPCTSTR pszMsg = LoadStringEx (IDS_DISPLAY_PRETEST); |
LPCTSTR pszMsg = LoadStringEx (IDS_DISPLAY_PRETEST); |
||
|
|
||
if (pszTitle && pszMsg) |
if (pszTitle && pszMsg) |
||
result = MessageBox (pszMsg, pszTitle, MB_ICONINFORMATION | MB_OK); |
result = MessageBox (pszMsg, pszTitle, MB_ICONINFORMATION | MB_OK); |
||
|
|
||
//This part To be removed when oem code is implemented |
//This part To be removed when oem code is implemented |
||
if(result != IDCANCEL) |
if(result != IDCANCEL) |
||
{ |
{ |
||
result = MessageBox(LoadStringEx(IDS_TEST_RESOL |
result = MessageBox(LoadStringEx(IDS_TEST_RESOL |
||
} |
} |
||
else |
else |
||
{ |
{ |
||
return 0; |
return 0; |
||
} |
} |
||
//End of part to be removed |
//End of part to be removed
|
||
|
|
||
|
|
||
if (result != IDCANCEL) |
if (result != IDCANCEL) |
||
{ |
{ |
||
CCleanUpDlg cleanUp; |
CCleanUpDlg cleanUp; |
||
cleanUp.Create (m_hwnd); |
cleanUp.Create (m_hwnd); |
||
cleanUp.SetWindowPos (HWND_TOPMOST, 0, 0, width, height, SWP_SHOWWINDOW); |
cleanUp.SetWindowPos (HWND_TOPMOST, 0, 0, width, height, SWP_SHOWWINDOW); |
||
|
|
||
m_bTested = FALSE; |
m_bTested = FALSE; |
||
TestDesktopResolution(); |
TestDesktopResolution(); |
||
cleanUp.SetWindowPos(HWND_TOPMOST, 0, 0, width, height, SWP_HIDEWINDOW); |
cleanUp.SetWindowPos(HWND_TOPMOST, 0, 0, width, height, SWP_HIDEWINDOW); |
||
|
|
||
pszTitle = LoadStringEx (IDS_TESTING_CAPTION); |
pszTitle = LoadStringEx (IDS_TESTING_CAPTION); |
||
pszMsg = LoadStringEx (IDS_TEST_SUCCESS); |
pszMsg = LoadStringEx (IDS_TEST_SUCCESS); |
||
|
|
||
result = IDNO; |
result = IDNO; |
||
if (pszTitle && pszMsg) |
if (pszTitle && pszMsg) |
||
result = MessageBox (pszMsg, pszTitle, MB_ICONINFORMATION | MB_YESNO); |
result = MessageBox (pszMsg, pszTitle, MB_ICONINFORMATION | MB_YESNO); |
||
|
|
||
if (result != IDNO) |
if (result != IDNO) |
||
m_bTested = TRUE; |
m_bTested = TRUE; |
||
cleanUp.DestroyWindow(); |
cleanUp.DestroyWindow(); |
||
} |
} |
||
|
*/
|
||
|
HKEY hKey;
|
||
|
TCHAR *pCurSettings;
|
||
|
TCHAR szSettings[128];
|
||
|
TCHAR szBuf[128];
|
||
|
int i,j;
|
||
|
i = m_displayChoices.SendMessage(CB_GETCUR |
||
|
if ( i == CB_ERR ) return 0;
|
||
|
m_displayChoices.SendMessage(CB_GETLBT |
||
|
// Parse display settings string
|
||
|
for ( i = 0, j = 0; szBuf[i]; i++ )
|
||
|
if ( iswdigit(szBuf[i]) || iswspace(szBuf[i]) )
|
||
|
szSettings[j++] = szBuf[i];
|
||
|
szSettings[j] = szBuf[i];
|
||
|
// Setup registry
|
||
|
hKey = OpenRegistryKey(HKLM, L"Software\\Geode", KEY_WRITE);
|
||
|
if ( !hKey ) return 0;
|
||
|
// Backup working display settings
|
||
|
if ( !GetRegistryKeyString(hKey, L"CurrentResolution") )
|
||
|
{
|
||
|
pCurSettings = GetRegistryKeyString(hKey, L"Resolution");
|
||
|
if ( pCurSettings )
|
||
|
{
|
||
|
SetRegistryKeyString(hKey, L"CurrentResolution", pCurSettings);
|
||
|
free(pCurSettings);
|
||
|
}
|
||
|
}
|
||
|
// Set display settings to test |
||
|
SetRegistryKeyString(hKey, L"Resolution", szSettings);
|
||
|
CloseRegistryKey(hKey);
|
||
|
|
||
return 1; |
return 1; |
||
} |
} |
||
|
|
||
|
|
||
LRESULT CCleanUpDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) |
LRESULT CCleanUpDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) |
||
{ |
{ |
||
// center window |
// center window |
||
CenterWindow (GetParent()); |
CenterWindow (GetParent()); |
||
return 1; |
return 1; |
||
} |
} |
||
|
|
||
|
|
||
BOOL CDisplayPropPage::Validate() |
BOOL CDisplayPropPage::Validate() |
||
{ |
{ |
||
return TRUE; |
return TRUE; |
||
} |
} |
||
|
|
||
BOOL CDisplayPropPage::StoreData() |
BOOL CDisplayPropPage::StoreData() |
||
{ |
{ |
||
TCHAR szBuf[10]={0}; |
TCHAR szBuf[10]={0}; |
||
|
|
||
if(!m_bWizard) |
if(!m_bWizard) |
||
{ |
{ |
||
|
|
||
m_scrSaverTimeout.GetWindowText(szBuf, |
m_scrSaverTimeout.GetWindowText(szBuf, |
||
|
|
||
if ( ( szBuf != NULL ) && ( szBuf[0] != '\0' ) ) |
if ( ( szBuf != NULL ) && ( szBuf[0] != '\0' ) ) |
||
m_nScrTimeout = _ttoi(szBuf); |
m_nScrTimeout = _ttoi(szBuf); |
||
} |
} |
||
return TRUE; |
return TRUE; |
||
} |
} |
||
|
|
||
BOOL CDisplayPropPage::UpdateDisplayChoices |
BOOL CDisplayPropPage::UpdateDisplayChoices |
||
{ |
{ |
||
HKEY hKey = NULL; |
HKEY hKey = NULL; |
||
DWORD index = 0; |
DWORD index = 0; |
||
DWORD curColor = 0; |
DWORD curColor = 0; |
||
TCHAR* szSubKey = NULL; |
TCHAR* szSubKey = NULL; |
||
UINT arrayCount = 0; |
UINT arrayCount = 0; |
||
LPTSTR curResolution=NULL; |
LPTSTR curResolution=NULL; |
||
TCHAR value[s_MAX_DISPLAYVALUELEN ]; |
TCHAR value[s_MAX_DISPLAYVALUELEN ]; |
||
int defaultIndex=-1; |
int defaultIndex=-1; |
||
BOOL fRet = FALSE; |
BOOL fRet = FALSE; |
||
TCHAR *setting = NULL; |
TCHAR *setting = NULL; |
||
|
|
||
memset(value ,0, s_MAX_DISPLAYVALUELEN ); |
memset(value ,0, s_MAX_DISPLAYVALUELEN ); |
||
hKey = OpenRegistryKey(HKEY_LOCAL_MACHINE,RES |
hKey = OpenRegistryKey(HKEY_LOCAL_MACHINE,RES |
||
|
|
||
if (hKey != NULL ) |
if (hKey != NULL ) |
||
{ |
{ |
||
RETAILMSG(1,(L"ATLPROP::UpdateDisplayC |
RETAILMSG(1,(L"ATLPROP::UpdateDisplayC |
||
setting = (TCHAR *)malloc(s_MAX_DISPLAYVALUELEN *sizeof(TCHAR)); |
setting = (TCHAR *)malloc(s_MAX_DISPLAYVALUELEN *sizeof(TCHAR)); |
||
if ( setting == NULL) |
if ( setting == NULL) |
||
{ |
{ |
||
RETAILMSG(1,(L"ATLPROP::UpdateDisplayC |
RETAILMSG(1,(L"ATLPROP::UpdateDisplayC |
||
goto EXIT; |
goto EXIT; |
||
} |
} |
||
|
|
||
if (!GetCurrentDisplaySetting(setting)) |
if (!GetCurrentDisplaySetting(setting)) |
||
{ |
{ |
||
RETAILMSG(1,(L"ATLPROP::UpdateDisplayC |
RETAILMSG(1,(L"ATLPROP::UpdateDisplayC |
||
goto EXIT; |
goto EXIT; |
||
} |
} |
||
|
|
||
while( ( szSubKey = EnumerateRegistryValues(hKey,index) ) != NULL ) |
while( ( szSubKey = EnumerateRegistryValues(hKey,index) ) != NULL ) |
||
{ |
{ |
||
|
|
||
if((m_displayTableName[index]= GetRegistryString(HKEY_LOCAL_MACHINE, |
if((m_displayTableName[index]= GetRegistryString(HKEY_LOCAL_MACHINE, |
||
RESOLUTION_CHOICES_NAME, |
RESOLUTION_CHOICES_NAME, |
||
szSubKey |
szSubKey |
||
)) != FALSE ) |
)) != FALSE ) |
||
{ |
{ |
||
ASSERT(m_displayTableName[index] !=NULL); |
ASSERT(m_displayTableName[index] !=NULL); |
||
StringCchCopy(value,s_MAX_DISPLAYVALUE |
StringCchCopy(value,s_MAX_DISPLAYVALUE |
||
if(wcscmp(value,setting)==0) |
if(wcscmp(value,setting)==0) |
||
{ |
{ |
||
defaultIndex=index; |
defaultIndex=index; |
||
} |
} |
||
m_displayChoices.SendMessage (CB_INSERTSTRING,index,reinterpret_cas |
m_displayChoices.SendMessage (CB_INSERTSTRING,index,reinterpret_cas |
||
RETAILMSG (1,(L"ATLPROP::UpdateDisplayChoices1() |
RETAILMSG (1,(L"ATLPROP::UpdateDisplayChoices1() |
||
if ( szSubKey != NULL) |
if ( szSubKey != NULL) |
||
{ |
{ |
||
free(szSubKey); |
free(szSubKey); |
||
} |
} |
||
index++; |
index++; |
||
} |
} |
||
else |
else |
||
{ |
{ |
||
RETAILMSG(1,(L"ATLPROP::UpdateDisplayC |
RETAILMSG(1,(L"ATLPROP::UpdateDisplayC |
||
goto EXIT; |
goto EXIT; |
||
} |
} |
||
} |
} |
||
} |
} |
||
else |
else |
||
{ |
{ |
||
RETAILMSG(1,(L"ATLPROP::UpdateDisplayC |
RETAILMSG(1,(L"ATLPROP::UpdateDisplayC |
||
goto EXIT; |
goto EXIT; |
||
} |
} |
||
if(defaultIndex == -1) |
if(defaultIndex == -1) |
||
defaultIndex = 0; |
defaultIndex = 0; |
||
|
|
||
// Please note |
// Please note |
||
// m_test.EnableWindow |
// m_test.EnableWindow |
||
// Reason for adding this line: After populating the combo box someone need to test the resolution. |
// Reason for adding this line: After populating the combo box someone need to test the resolution. |
||
// Reason for removing this line: This will be implemented y OEM and there is no need to eable this button. |
// Reason for removing this line: This will be implemented y OEM and there is no need to eable this button. |
||
//m_test.EnableWindow(TRUE); |
//m_test.EnableWindow(TRUE); |
||
|
|
||
m_displayChoices.SendMessage (CB_SETCURSEL,defaultIndex,0); |
m_displayChoices.SendMessage (CB_SETCURSEL,defaultIndex,0); |
||
//Setting for enabling disabling of test button |
//Setting for enabling disabling of test button |
||
m_curSetting = defaultIndex; |
m_curSetting = defaultIndex; |
||
|
|
||
fRet = TRUE; // Success! |
fRet = TRUE; // Success! |
||
|
|
||
EXIT: |
EXIT: |
||
if (setting) |
if (setting) |
||
free(setting); |
free(setting); |
||
if (hKey) |
if (hKey) |
||
CloseRegistryKey(hKey); |
CloseRegistryKey(hKey); |
||
return fRet; |
return fRet; |
||
} |
} |
||
|
|
||
BOOL CDisplayPropPage::GetCurrentDisplaySet |
BOOL CDisplayPropPage::GetCurrentDisplaySet |
||
{ |
{ |
||
|
/*
|
||
DWORD size = 0; |
DWORD size = 0; |
||
DWORD type = 0; |
DWORD type = 0; |
||
HKEY hKey = NULL; |
HKEY hKey = NULL; |
||
|
|
||
|
|
||
if (!curDisplay) |
if (!curDisplay) |
||
{ |
{ |
||
return FALSE; |
return FALSE; |
||
} |
} |
||
|
|
||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,LOCAL |
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,LOCAL |
||
{ |
{ |
||
return FALSE; |
return FALSE; |
||
} |
} |
||
|
|
||
if (RegQueryValueEx(hKey,DISPLAY_VALUE_NA |
if (RegQueryValueEx(hKey,DISPLAY_VALUE_NA |
||
{ |
{ |
||
CloseRegistryKey(hKey); |
CloseRegistryKey(hKey); |
||
return FALSE; |
return FALSE; |
||
} |
} |
||
|
|
||
if (RegQueryValueEx(hKey,DISPLAY_VALUE_NA |
if (RegQueryValueEx(hKey,DISPLAY_VALUE_NA |
||
{ |
{ |
||
CloseRegistryKey(hKey); |
CloseRegistryKey(hKey); |
||
return FALSE; |
return FALSE; |
||
} |
} |
||
|
*/
|
||
|
TCHAR *pSettings;
|
||
|
int i,j;
|
||
|
if (!curDisplay) return FALSE;
|
||
|
pSettings = GetRegistryString(HKLM, L"Software\\Geode", L"Resolution");
|
||
|
if ( !pSettings ) return FALSE;
|
||
|
// Write xres
|
||
|
for ( i = 0, j = 0; iswdigit(pSettings[i]) && pSettings[i]; i++,j++ )
|
||
|
curDisplay[j] = pSettings[i];
|
||
|
wcscat(curDisplay, L" x ");
|
||
|
// Skip spaces
|
||
|
for ( ; !iswdigit(pSettings[i]) && pSettings[i]; i++ );
|
||
|
// Write yres
|
||
|
for ( ; iswdigit(pSettings[i]) && pSettings[i]; i++,j++ )
|
||
|
curDisplay[j] = pSettings[i];
|
||
|
wcscat(curDisplay, L" @");
|
||
|
// Skip spaces
|
||
|
for ( ; !iswdigit(pSettings[i]) && pSettings[i]; i++ );
|
||
|
// Write refresh rate
|
||
|
for ( ; iswdigit(pSettings[i]) && pSettings[i]; i++,j++ )
|
||
|
curDisplay[j] = pSettings[i];
|
||
|
wcscat(curDisplay, L"Hz");
|
||
|
|
||
return TRUE; |
return TRUE; |
||
} |
} |
||
|
|
||
// |
// |
||
// set the display info in the registry |
// set the display info in the registry |
||
// |
// |
||
BOOL CDisplayPropPage::SetDisplayInfo( ) |
BOOL CDisplayPropPage::SetDisplayInfo( ) |
||
{ |
{ |
||
UINT selIndex=0; |
UINT selIndex=0; |
||
UINT colIndex=0 ; |
UINT colIndex=0 ; |
||
HKEY hKey = NULL; |
HKEY hKey = NULL; |
||
TCHAR szSelDisplay[DISPLAYCOMBO_LEN]={0}; |
TCHAR szSelDisplay[DISPLAYCOMBO_LEN]={0}; |
||
|
|
||
selIndex = m_displayChoices.SendMessage( CB_GETCURSEL,0,0 ); |
selIndex = m_displayChoices.SendMessage( CB_GETCURSEL,0,0 ); |
||
|
|
||
if ((selIndex == CB_ERR) || (m_displayChoices.SendMessage ( CB_GETLBTEXT, |
if ((selIndex == CB_ERR) || (m_displayChoices.SendMessage ( CB_GETLBTEXT, |
||
(WPARAM)selIndex, |
(WPARAM)selIndex, |
||
(LPARAM)szSelDisplay) |
(LPARAM)szSelDisplay) |
||
== CB_ERR )) |
== CB_ERR )) |
||
{ |
{ |
||
RETAILMSG (1,(L"CDisplayPropPage::SetDisplayInfo |
RETAILMSG (1,(L"CDisplayPropPage::SetDisplayInfo |
||
return FALSE; |
return FALSE; |
||
} |
} |
||
|
|
||
hKey = OpenRegistryKey(HKLM,LOCAL_COLOR_CONFI |
hKey = OpenRegistryKey(HKLM,LOCAL_COLOR_CONFI |
||
|
|
||
if ( hKey == NULL ) |
if ( hKey == NULL ) |
||
{ |
{ |
||
// Create the Color Key |
// Create the Color Key |
||
hKey = CreateRegistryKey( HKLM,LOCAL_COLOR_CONFIG_KEY ); |
hKey = CreateRegistryKey( HKLM,LOCAL_COLOR_CONFIG_KEY ); |
||
if ( hKey == NULL ) |
if ( hKey == NULL ) |
||
{ |
{ |
||
RETAILMSG(1,(L"CDisplayPropPage::SetDi |
RETAILMSG(1,(L"CDisplayPropPage::SetDi |
||
return FALSE; |
return FALSE; |
||
} |
} |
||
} |
} |
||
|
|
||
for(int k=0; k<MAX_DISPLAY_KEYS; k++) |
for(int k=0; k<MAX_DISPLAY_KEYS; k++) |
||
{ |
{ |
||
if (wcscmp(m_displayTableName[k],szSelDis |
if (wcscmp(m_displayTableName[k],szSelDis |
||
{ |
{ |
||
colIndex= k; |
colIndex= k; |
||
} |
} |
||
} |
} |
||
// set the color value corresponding to the selection in the combobox. |
// set the color value corresponding to the selection in the combobox. |
||
SetRegistryKeyString( hKey, DISPLAY_VALUE_NAME , m_displayTableName[colIndex] ); |
SetRegistryKeyString( hKey, DISPLAY_VALUE_NAME , m_displayTableName[colIndex] ); |
||
RETAILMSG (1,(L"CDisplayPropPage::SetDisplayInfo |
RETAILMSG (1,(L"CDisplayPropPage::SetDisplayInfo |
||
m_displayTableName[colIndex],colIndex) |
m_displayTableName[colIndex],colIndex) |
||
CloseRegistryKey(hKey); |
CloseRegistryKey(hKey); |
||
return TRUE; |
return TRUE; |
||
} |
} |
||
|
|
||
LRESULT CDisplayPropPage::OnSetActive(int idCtrl, LPNMHDR pnmh, BOOL &bHandled) |
LRESULT CDisplayPropPage::OnSetActive(int idCtrl, LPNMHDR pnmh, BOOL &bHandled) |
||
{ |
{ |
||
if(m_bWizard) |
if(m_bWizard) |
||
{ |
{ |
||
|
|
||
GetOwner().SetWizFlags (PSWIZB_BACK | PSWIZB_NEXT); |
GetOwner().SetWizFlags (PSWIZB_BACK | PSWIZB_NEXT); |
||
|
|
||
} |
} |
||
return 0; |
return 0; |
||
} |
} |
||
|
|
||
|
|